﻿package cocoaas3{

	import flash.display.*;
	import flash.events.*;

	public class UIBarButtonItem extends UIBarItem {


		//
		//-------------------------------------------------------------------------------------------
		// original variables
		//-------------------------------------------------------------------------------------------
		//
		public var customView:Sprite;
		public var action:Function;


		//
		//-------------------------------------------------------------------------------------------
		// original functions
		//-------------------------------------------------------------------------------------------
		//
		public function UIBarButtonItem( $customView:Sprite ):void{
			customView = $customView;
			customView.buttonMode = true;
			customView.mouseChildren = false;
			customView.addEventListener( MouseEvent.CLICK, _onClick );
		}

		private function _onClick( e:MouseEvent):void{
			action();
		}



	}
}